# Maintainer: Sven-Hendrik Haase <svenstaro@archlinux.org>
# Contributor: Nicola Squartini <tensor5@gmail.com>

pkgname=asar
pkgver=3.2.3
pkgrel=1
pkgdesc='Creating Electron app packages'
arch=('any')
url='https://github.com/electron/asar'
license=('MIT')
depends=('nodejs')
makedepends=('npm')
options=(!emptydirs)
noextract=("${_pkgname}-${pkgver}.tgz")
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/electron/asar/archive/refs/tags/v${pkgver}.tar.gz")
sha512sums=('bcffe15694c7bbb0160e50d8cff761ae24b4e63768f499e5129cc2f893cf33e2ef15179496e39803dbdd418d8c2883a2b16396c2d4433d8332168b40ee1ec7d2')

package() {
    npm install -g --prefix "${pkgdir}/usr" "${srcdir}/${pkgname}-${pkgver}.tar.gz"
    chown -R root:root "${pkgdir}"

    install -Dm644 "${pkgdir}/usr/lib/node_modules/@electron/asar/LICENSE.md" "${pkgdir}/usr/share/licenses/asar/LICENSE.md"
}
